#!/bin/bash

if [[ "$(uname -s)" == "FreeBSD" ]]; then
	sudo pkg install -y git git-lfs
fi

if [[ "$(uname -s)" == "Linux" ]]; then
	if type dnf &>/dev/null; then
		sudo dnf -y install git git-lfs
	elif type apt &>/dev/null; then
		sudo apt install -y git git-lfs
	elif type zypper &>/dev/null; then
		sudo zypper install -y git git-lfs
	elif type mamba &>/dev/null; then
		mamba install git git-lfs -y
	fi
fi

git config --global user.name "zhjch"
git config --global user.email "bingyu27@126.com"
git config --global core.symlinks true
git config --global init.defaultBranch main
git config --global pull.rebase false
git config --global core.editor nvim
if [[ "$(uname -s)" == "Darwin" ]]; then
	git config --global http.https://github.com.proxy http://127.0.0.1:7890
	git config --global https.https://github.com.proxy https://127.0.0.1:7890
fi
git config --global --add push.default current
git config --global --add push.autoSetupRemote true
git config --global credential.helper store
curl -SsL https://gitee.com/hevey88/git_conf/raw/main/.gitignore_global -o ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

if [[ "$(uname -s)" == "Darwin" ]]; then
	if type mamba &>/dev/null; then
		mamba install git-lfs -y
	elif type brew &>/dev/null; then
		brew install git-lfs
		# git config --global http.https://github.com.proxy socks5://127.0.0.1:7890
		# git config --global https.https://github.com.proxy socks5://127.0.0.1:7890
	fi
fi

if type git &>/dev/null; then
	if type git-lfs &>/dev/null; then
		git lfs install
	fi
fi

# if [[ ("$(uname -s)" == "Linux" && "$(uname -m)" == "x86_64") || "$(uname -s)" == "Darwin" ]]; then
# 	brew install git-lfs && git lfs install
# fi
# if [[ "$(uname -s)" == "Linux" ]]; then
# 	git config --global http.https://github.com.proxy socks5://10.211.55.2:7890
# 	git config --global https.https://github.com.proxy socks5://10.211.55.2:7890
# 	(sudo dnf install -y git-lfs && git lfs install)
# fi
